<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>个人会员注册--${site.name }</title>
<jsp:include page="inc/css.jsp"></jsp:include>
<jsp:include page="inc/js.jsp"></jsp:include>
<jsp:include page="inc/xheditor.jsp"></jsp:include>
<script type="text/javascript">
	$(document).ready(function() {
	$.get("getSelect.do", {
			type : '0'
		}, function(data) {
			$("select#married").append(data);
		});
		$.get("getSelect.do", {
			type : '2'
		}, function(data) {
			$("select#sex").append(data);
		});
		$.get("getSelect.do", {
			type : '1',
			code : null
		}, function(data) {
			$("select#region_treeCode").append(data);
		});
		$.get("getSelect.do", {
			type : '3'
		}, function(data) {
			$("select#degree").append(data);
		});
		$.get("getSelect.do", {
			type : '4'
		}, function(data) {
			$("select#nation").append(data);
		});
		$.get("getSelect.do", {
			type : '5'
		}, function(data) {
			$("select#workType").append(data);
		});
		$.get("getSelect.do", {
			type : '7',
			code : null
		}, function(data) {
			$("select#major").append(data);
		});
		$.get("getSelect.do", {
			type : 'zw',
			code : null
		}, function(data) {
			$("select#position").append(data);
		});
		$("#reg").button().click(function() {
			if ($("#loginName").val() == '') {
				alert('请输入用户名！');
				return false;
			}
			if ($("#realName").val() == '') {
				alert('请输入真实姓名！');
				return false;
			}
			if ($("#pwd").val() == '') {
				alert('请输入密码！');
				return false;
			}
			if ($("#pwd1").val() == '') {
				alert('请输入确认密码！');
				return false;
			}
			if ($("#pwd1").val() != $("#pwd").val()) {
				alert('两次输入的密码不相同！');
				return false;
			}
			if ($("#code").val()== '') {
				alert('请输入验证码！');
				return false;
			}
			
			
			$('#f').ajaxForm(function(data) {
				var o = jQuery.parseJSON(data);
					if(o.success){
						//clearApplication();
						alert('操作成功！');
					}
					else
						alert('操作失败！'+o.err);
			});
		});
		$("#close").button().click(function() {
			window.close();
		});

		$("#file").button().click(function() {
			$("#img").dialog( {
				title : '上传照片',
				height : 300,
				width : 630,
				modal : true
			});
			return false;
		});
		
		$("#upload").button().click(function() {
			$.ajaxFileUpload({
				url:'upload.do',
				secureuri:false,
				fileElementId:'inputfile',
				dataType: 'json',
				success: function (data, status){
					if(data.err){
						$("#pic").val(data.url);
						alert("上传成功！");
						$("#img").dialog('close');
					}else{
						alert('上传失败！');
					}
				}
			});
			return false;
		});
		$("#cancel").button().click(function() {
			$("#img").dialog('close');
			return false;
		});
		$("#check_loginName").button().click(function() {
			check();
			return false;
		});
	});
	function check() {
		if ($("#loginName").val() == '') {
			alert('请输入用户名！');
			return false;
		}
		$.get("checkUserLoginName.do", {
			loginName : $("#loginName").val()
		}, function(data) {
			alert(data);
		});
	}
</script>
</head>
<body>
<jsp:include page="head.jsp"></jsp:include>
<div class="container">
<jsp:include page="inc/menuPath.jsp">
	<jsp:param value="UserReg.jsp" name="url"/>
</jsp:include>
<form action="./regUser.do" id="f" method="post">
<fieldset><legend> 基本信息 </legend>
<div><label> 用户名：</label> <input type="text" id="loginName"
	name="loginName" onblur="check()"> *
<button id="check_loginName">检查是否存在</button>
</div>
<div><label> 真实姓名：</label> <input type="text" id="realName"
	name="realName"> *</div>
<div><label> 密 码：</label> <input type="password" id="pwd"
	name="pwd"> *</div>
<div><label> 确认密码：</label> <input type="password" id="pwd1"
	name="pwd1"> *</div>
<div><label> 年龄：</label> <input type="text" name="age"
	class="short" value="0"></div>
<div><label> 身高：</label> <input type="text" name="height"
	class="short" value="0"> cm</div>
<div><label> 性别：</label> <select id="sex" name="sex">
	<option value="">请选择</option>
</select></div>
<div><label> 民族：</label> <select id="nation" name="nation">
	<option value="">请选择</option>
</select></div>
<div><label> 学历：</label> <select id="degree" name="degree">
	<option value="">请选择</option>
</select></div>
<div><label> 是否结婚：</label> <select id="married" name="married">
	<option value="">请选择</option>
</select></div>
<div><label> 照片地址：</label> <input type="text" name="pic" id="pic" class="long">
<!-- <button id="file">上传</button> -->
</div>
<div><label> 地区：</label> <select id="region_treeCode"
	name="region_treeCode">
	<option value="">请选择</option>
</select></div>
</fieldset>
<fieldset><legend> 教育背景 </legend>
<div><label> 学校：</label> <input type="text" name="school">
</div>
<div><label> 专业：</label> <select id="major" name="major">
	<option value="">请选择</option>
</select></div>
</fieldset>
<fieldset><legend> 工作情况 </legend>
<div><label> 工作年限：</label> <input type="text" name="workYear"
	value="0" class="short"></div>
<div><label> 职位：</label> <select id="position" name="position">
	<option value="">请选择</option>
</select></div>
</fieldset>
<fieldset><legend> 求职意向 </legend>
<div><label> 期望工资：</label> <input type="text" name="wages" value="0"
	class="short"> 元</div>
<div><label> 兼职/全职：</label> <select id="workType" name="workType">
	<option value="">请选择</option>
</select></div>
</fieldset>
<fieldset><legend> 联系方式 </legend>
<div><label> 电话：</label> <input type="text" name="tel"></div>
<div><label> 手机：</label> <input type="text" name="phone">
</div>
<div><label> QQ：</label> <input type="text" name="qq"></div>
<div><label> E-mail：</label> <input type="text" name="email">
</div>
<div><label> 地址：</label> <input type="text" name="address"
	class="long"></div>
<div><label> 个人说明：</label> <textarea name="summary" id="summary" style="width: 500px; height: 300px;" class="xheditor-mini"></textarea>
	2000字符
</div>
<div><label> 输入验证码：</label> <input type="text" name="code"
	id="code" style="width: 30px;"> <img
	style="margin: 0; border: 0; cursor: hand" title="点击切换图片" align="top"
	src="getCodeImg" onClick="codeImg(this);" /></div>
</fieldset>
<center>
<button id="reg">注册</button>
<button id="close">关闭</button>
</center>
</form>
</div>
<div id="img" style="display: none;">
<form action="upload.do" id="upload_form" enctype="multipart/form-data">
<input type="file" name="file" id="inputfile" value="浏览" /><br />
<button id="upload">上传</button>
<button id="cancel">关闭</button>
</form>
</div>
<jsp:include page="foot.jsp"></jsp:include>
</body>
</html>